<%--
    Document   : index
    Created on : Oct 7, 2008, 8:50:36 AM
    Author     : nbuser

 SELECT expense_item_id, reference_number, expense_date, expense_type_id
         , payment_type_id, client_id, price, description, note, billable
    FROM expense_items
--%>

<%@page import="com.bitzer.google.Contacts"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login page</title>
</head>
<body>
    <%

    try {

    String username = request.getParameter("username");
    String password = request.getParameter("password");

    Contacts contacts = Contacts.instance();
    contacts.authenticate(username, password);

    session.setAttribute("username", username);
    session.setAttribute("password", password);
    
    response.sendRedirect(request.getContextPath()+"/library.jsp");

    } catch (Exception e) {
        
        //out.println(e.getMessage());
        //out.println("not logged in");
        response.sendRedirect(request.getContextPath()+"/login.jsp");
    }

    %>
                            
</body>
</html>